<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
${aier_doctype}
<html <s:property value="aier_html_xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<title><s:property value="ev_title" /></title>
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}/ui.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />
<link rel="stylesheet" href="${aier_css_url}jp/1.css" />
<link rel="stylesheet" href="${aier_css_url}index/fam-user-mana.css" />
<link href="${aier_css_url}jc/chosen.css" rel="stylesheet">
<link href="${aier_css_url}jq/jq.css" rel="Stylesheet" />
<link rel="stylesheet" href="${aier_css_url}comm/text.css" />
<link rel="stylesheet" href="${aier_css_url}admin/admin.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/1.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/afu.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/hh/ui.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/arrayList.js"></script>
<script type="text/javascript" src="${aier_js_url}jc/cj.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}comm/text.js"></script>
</head>
<script type="text/javascript">
$(document).ready(function(){
    $("#schoolCardinfo").jqGrid({                
        url:'${aier_url}${aier_urijs}adminrecoverschool_search_admin${aier_suffix}',                
        datatype:"json",                
        mtype:'GET',
        height:'230',
        width:'960',              
        colNames:['学校名称','IC卡号','归属','卡状态','操作','状态','icid'],                
        colModel:[                    
        {name:'sname',index:'sname',width:150,align:'center'},
        {name : 'cardnum',index : 'cardnum',width : 120,align:'center'}, 
        {name : 'name_card',index : 'name_card',width : 150,sortable : false,align:'center'},
        {name : 'state_str',index : 'state_str',width : 100,sortable : false,align:'center'}, 
        {name : 'option',index : 'option',width : 100,sortable : false,align:'center'}, 
        {name:'state',index:'state',hidden:true},
        {name:'icid',index:'icid',hidden:true}
        ],
        //autowidth:true,
        jsonReader: {
            root:"schoolIcCardList",
            page: "page",
            total: "page_count",
            records : "count",
            repeatitems: false
        },
        pager: jQuery("#schoolCardpage"),
        prmNames : {page:"page",sort: "sort"},
        rowNum: 10,
        sortname: 'sid',
        hidegrid: false,
        sortorder: 'asc',
        viewrecords: true,
        caption: '购买短信',
        gridComplete:function(){
            var ids=jQuery("#schoolCardinfo").jqGrid('getDataIDs');
            for(var i=0; i<ids.length; i++){
            	var id=ids[i];   
                var hs = "<a href='javascript:;'  class='jqtrow' onclick='delTel(" + id + ")'>回收</a>"; 
                jQuery("#schoolCardinfo").jqGrid('setRowData', ids[i],{option:hs});
            }
        }
    }).navGrid("#schoolCardpage", { edit: false, add: false, del: false, search: false });
}); 
</script>
<body style="background-color: #EEF2FB;">
    
    <div style="background-color: #EEF2FB;width: 100%;height: 700px; ">
       
        <div id="tabs">
	        <ul>
	            <li><a href="#tabs-1">回收学校卡</a></li>
	        </ul>
            <div id="tabs-1" style="height: 500px;">
                 <div class="d_content">
                    <div class="d_scnOut">
                        <div class="d_scname" style="margin-left: 0px;">
                            <label for="name">学校名称: </label>
                        </div>
                        <div class="d_sctext">
                            <input type="text" id="sname" />
                        </div>
                    </div>
                    <div class="d_scnOut" style="margin-left: 300px;margin-top: -40px;">
                        <div class="d_scname" >
                            <label for="name">卡号: </label>
                        </div>
                        <div class="d_sctext">
                            <input type="text" id="cardnum" />
                        </div>
                    </div>
                    <div class="d_scnOut" style="margin-left: 0px;">
                        <div class="d_scname" >
                            <label for="name">卡状态: </label>
                        </div>
                        <div class="sel_region">
	                        <select id="card_state_types" class="chosen">
                                <option value="-1">请选择</option>
                                <option value="10">启用</option>
                                <option value="20">注销</option>
                            </select>
	                    </div>
                    </div>
                    
                    <div style="margin-left: 600px;margin-top: -47px;">
                        <button onclick="search_card();"
                            class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
                            role="button" aria-disabled="false">
                            <span class="ui-button-text">查询</span>
                        </button>
                    </div>
                    
                     <!-- 表格 -->
                     <div style="margin-left: 0px;margin-top: 20px;">
                         <table id="schoolCardinfo"></table>
                         <div id="schoolCardpage"></div>
                     </div>
                            
                </div>
                
            </div>
        </div>

	<!-- 回收ic卡弹出层 -->
    <div id="ic_del" style="display: none;" title="回收ic卡">
        您确定要将<span id="deltname"></span> 的这张卡回收吗?
    </div>
    </div>

	<script type="text/javascript">
	$("#tabs").tabs();
	$(".chosen").chosen();
	//查询
    function search_card() {
        var sname = $('#sname').val();
        var cardnum = $('#cardnum').val();//卡号
        var state = $('#card_state_types  option:selected').val();//卡状态
        if (null != cardnum && "" != cardnum && cardnum.length != 8) {
        	$().message("请输入正确的卡号");
        	return
        }
        jQuery("#schoolCardinfo")
                .jqGrid(
                        'setGridParam',
                        {
                            url : "${aier_url}${aier_urijs}adminrecoverschool_search_admin${aier_suffix}?sname="
                                    + sname + "&cardnum=" + cardnum + "&state=" + state,
                            page : 1
                        }).trigger("reloadGrid");
    }
	
	// 回收卡
	function delTel(id){
	     $("#deltname").html(jQuery("#schoolCardinfo").jqGrid('getRowData', id).cardnum);
	     $(function() {
	            $( "#ic_del" ).dialog({
	                modal: true,
	                resizable: false,
	                buttons: {
	                    "回收": function() {
	                        var fun = function(data){
	                            if(1==data.s){
	                                 $().message("回收成功!");
	                                 $("#schoolCardinfo").trigger("reloadGrid");
	                                 $("#ic_del").dialog( "close" );
	                            }else{
	                                 $().message("回收失败!");
	                            }
	                        };
	                        exeAjax(ajaxUrl('${aier_url}${aier_urijs}adminrecoverschool_delete${aier_suffix}'), fun, 
	                                {"icid" :jQuery("#schoolCardinfo").jqGrid('getRowData', id).icid});
	                    },"取消": function() {
	                        $( this ).dialog( "close" );
	                    }
	                }
	            });
	        });
	 }

	</script>
</body>
</html>